/**	@file Pow.h
 *	@brief Representation of powers. */
#ifndef op_majdo_
#define op_majdo_
#include <vector>
#include "Ex.h"
namespace sympycpp {
/**	@class Pow
 *      @brief Representation of powers. */
class Pow:public Ex{
private:
	///	@brief the expression in the exponent of the power
	Ex * exponent_;
	///	@brief the expression in the base of the power
	Ex * base_ ;
	/**	@brief The direct access to the base and exponent of the power.
	 * 	
	 * 	This function enables manipulation with parts of the power. 
	 * 	It assumes that the power is redundant.
	 * 	The base and exponent are moved to the parameters of this function, 
	 * 	and then the power is an invalid object and it should be deleted.
	 * 	
	 * 	@warning This function demages object of power. The object can not be used in 
	 * 	the next computation.
	 * 	@warning User is responsible for release of the memory that is owned by parameters. 
	 * 	@param b will own the expression from the base
	 * 	@param e will own the expression from the exponent*/
	void ganef(Ex * & b, Ex * & e, const allocationPolicy);
	/**	@brief Standard construction of power.
	 * 	This standard cotructor makes copies of input expressions.
	 * 	@param b is the base of the power
	 * 	@param e is the exponent of the power */
	Pow(const Ex * b, const Ex * e);
	/**	@brief Special construction of the power.
	 *      Constructor exploits memory of both input pointers.
	 *	@warning Input pointers don't point to expressions after the construction.
	 *	@see allocationPolicy : special memory management*/
	Pow(Ex * &, Ex * &, const allocationPolicy);
public:
	//	@brief Standard copy constructor.
	Pow(const Pow &);
	virtual ~Pow();			
	virtual std::string treeView(const int i) const;
	virtual std::string str()const;
	virtual std::string unsigned_str() const;
	virtual size_t rsize(const bool all = true) const;
	virtual size_t asize() const;
	virtual size_t size()const;
	virtual Ex * diff(const Sym & x)const;
	virtual Ex * copy() const;
	/**	@brief Construction of the copy of the power with the opposite expression in the exponent. */
	Ex * copyInverted() const;
	///	@brief Is the exponent integer?
	bool isExponentInteger() const;
	///	@brief	Is the exponent positive?
	bool isExponentPositive() const;
	/**	@brief Special conversion into the std::string.
	 * 	It's useful (only for powers with negative sign in exponent) for transformations from powers to fractions. */  
	std::string abs_Exp_str()const;	
	friend class Substitution;
	friend class ComparerIx;
	friend class Operations;
	friend class Utilities;
};
}
#endif
